﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.Storage;

namespace Looptribe.Moodlin8.Model.Api
{
    public interface IMoodleApiService
    {
        string Token { get; }

        bool IsLogged { get; }

        void Logout();

        Task<IResponse<string>> AuthenticateAsync(ServiceCredentials credentials);

        Task<IResponse<WebserviceInfo>> GetWebserviceInfo();

        Task<IResponse<IEnumerable<Course>>> GetCoursesAsync();
        Task<IResponse<IEnumerable<Course>>> GetEnrolledCoursesAsync(User user);
        Task<IResponse<IEnumerable<CourseContent>>> GetCourseContentsAsync(long id);
        Task<IResponse<IEnumerable<CourseUser>>> GetCourseEnrolledUsersAsync(long id);

        Task<IResponse<IEnumerable<CourseUser>>> GetContactsAsync();

        Task<IResponse<IEnumerable<Assignment>>> GetAssignmentsAsync(long courseId);
        Task<IResponse<IEnumerable<Assignment>>> GetAssignmentsAsync(IEnumerable<long> courseIds);

        Task<IResponse<IStorageFile>> DownloadFileAsync(File file);
        Task<IResponse<FileCompound>> GetFilesAsync(string filepath = null);
        Task<IResponse<File>> UploadFileAsync(IStorageFile file);

        Task<IResponse<IEnumerable<InstantMessage>>> GetMessagesAsync();
        Task<IResponse<IEnumerable<InstantMessage>>> GetMessagesAsync(long userid);
        Task<IResponse<InstantMessage>> SendMessageAsync(long userId, string message);

        Task<IResponse<IEnumerable<Event>>> GetEventsAsync(DateTime start, DateTime end);

        string GetDownloadUrl(ModuleContent content);

        Task<IResponse<IStorageFile>> DownloadFileAsync(string uri);
    }
}
